(function($){
    document.addEventListener("load",function() {
        if (!$.cookie) {
            var script = document.createElement("script");
            script.setAttribute("type", "text/javascript");
            script.setAttribute("src", "https://cdn.staticfile.org/jquery-cookie/1.4.1/jquery.cookie.min.js");
            document.body.appendChild(script);
        }
        if ($.cookie('notice') != "none"){
            $.get("/api/notice", null, function(data){
                if (data.code == 0){
                    if (!util.isNullString(data.data)){
                        $.sendConfirm({
                            hideHeader: true,
                            withIcon: true,
                            desc: data.data,
                            button: {
                                confirm: '确定',
                                cancel: '<div>不再显示</div>',
                            },
                            onCancel: function() {
                                $.cookie('notice', 'none', { expires: 7 });
                            }
                        });
                    }
                }
            });
        }
    })
})($);
